<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>新增供应商信息</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/sources/css/style.css">
<script type="text/javascript" src="${pageContext.request.contextPath}/sources/scripts/jquery-3.4.1.min.js"></script>
<script type="text/javascript">
function updatesubmit(){
	var food_name = $("#food_name").val();
	var food_price = $("#food_price").val();
	if(food_name==""||food_price==""){
		alert("食品名称或价格不能为空");
		return;
	}
	//发送Ajax请求
	var url="${pageContext.request.contextPath}/updateCheck";
	var param = $("#form").serialize();
	$.post(url,param,function(data){
		if(data=="1"){
			  
			window.location.href="${pageContext.request.contextPath}/food_list";
			var index = parent.layer.getFrameIndex(window.name);
				//关闭当前frame
				parent.layer.close(index);
				window.parent.location.reload();
			
		}
		else{
		alert(data);
		}
	});
	
}


</script>
<body>
	<!-- Table goes in the document BODY -->
	<form id="form">
		<table class="hovertable">
			<tr>
				<th colspan="2">修改供应商信息</th>
			</tr>
			<tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">
				<td>食品名称</td><td><input type="text" name="food_name" id="food_name" value="${food.food_name}"></td>
			</tr>
			<tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">
				<td>食品价格</td><td><input type="text" name="food_price" id="food_price" value="${food.food_price}"></td>
			</tr>
			<tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">
				<td>食品图片</td><td><input type="text" name="food_picture" value="${food.food_picture}"></td>
			</tr>
			<tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">
				<td>食品预约量</td><td><input type="text" name="food_number" value="${food.food_number}"></td>
			</tr>
			<tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">
				<td>食品星级</td><td><input type="text" name="food_start" value="${food.food_start}"></td>
			</tr>
			<tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">
				<td>食品描述</td><td><textarea cols=30 rows=5 name="food_desc">${food.food_desc}</textarea></td>
				<td><input type="hidden" name="food_id" value="${food.food_id}" ></input></td>
			</tr>
			 <tr style="background-color:#ffffff;text-align:center">
				<td colspan="2"><input type="button" value="提交" style="width:100%" onclick="updatesubmit()"></td>
			</tr>
		</table>
	</form>
</body>